
import Vue from 'vue'

import VueRouter from 'vue-router'

//注册激活插件
Vue.use(VueRouter);

import Home from '@/views/home/Home.vue'
import Vip from '@/views/vip/Vip.vue'
// import { create } from 'core-js/core/object';

import HomeFollow from '@/views/home/components/HomeFollow.vue'
import HomeHot from '@/views/home/components/HomeHot.vue'
import HomeRecommend from '@/views/home/components/HomeRecommend.vue'
import HomeVideo from '@/views/home/components/HomeVidoe.vue'
import HotDetail from '@/views/home/HotDetail.vue'

import VipHot from '@/views/vip/components/VipHot.vue'
import VipLive from '@/views/vip/components/VipLive.vue'
import VipStroy from '@/views/vip/components/VipStroy.vue'
import VipTeach from '@/views/vip/components/VipTeach.vue'

// 利用数组配置路由

const routes = [
    {
        id: 1, path: '/', component: Home, text: '首页',
        children: [
            { id: 101, text: '关注', path: '/fllow', component: HomeFollow, meta: { page: '/' } },
            { id: 102, text: '热榜', path: '/hot', component: HomeHot, meta: { page: '/' } },
            { id: 103, text: '推荐', path: '/', component: HomeRecommend, meta: { page: '/' } },
            { id: 104, text: '视频', path: '/video', component: HomeVideo, meta: { page: '/' } },
        ]
    },
    {
        id: 2, path: '/vip', component: Vip, text: '会员',
        children: [
            { id: 201, text: '热度榜', path: '/viphot', component: VipHot, meta: { page: '/vip' } },
            { id: 202, text: '技能榜', path: '/vipteach', component: VipTeach, meta: { page: '/vip' } },
            { id: 203, text: '故事榜', path: '/vipstroy', component: VipStroy, meta: { page: '/vip' } },
            { id: 204, text: 'Live榜', path: '/viplive', component: VipLive, meta: { page: '/vip' } }
        ]
    },
    { id: 3, path: '/hot/:id', component: HotDetail, }

];

// 导出路由 
export { routes };

// 生成  new  VueRouter所需要的路由规则
const createRouter = () => {
    return routes
}







// 创建router实例
export default new VueRouter({
    mode: 'history',  // 定义路由规则
    // 前面两个参数是固定的 执行createRouter() 函数  我们就创建了路由规则
    routes: createRouter()
})